<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
/**
* Simple example script using PHPMailer with exceptions enabled
* @package phpmailer
* @version $Id$
*/

require 'class.phpmailer.php';
require 'class.smtp.php';

//内容获取区
$title=$_POST['title'];     //标题
$email=$_POST['email'];  //评论的邮箱
$textarea=$_POST['textarea'];  //留言
try {
	$mail = new PHPMailer(true); //New instance, with exceptions enabled

	$body             = "访问者在三江潮潮人板给你发送了一封邮件."."<br>"."他的标题:".$title."<br>"."用户邮件:".$email."<br>"."他的留言:"."<br>"."你好：***"."<br> &nbsp;&nbsp;".$textarea;                                                                                                 //邮件内容 
	$body             = preg_replace('/\\\\/','', $body); //Strip backslashes

	$mail->IsSMTP();                           // tell the class to use SMTP
	$mail->SMTPAuth   = true;                  // enable SMTP authentication
	$mail->Port       = 25;                // set the SMTP server port
	$mail->Host       = "smtp.qq.com"; // SMTP server
	$mail->Username   = "850722725@qq.com";     // SMTP server username
	$mail->Password   = "as1395827686";            // SMTP server password

	//$mail->IsSendmail();  // tell the class to use Sendmail

	$mail->AddReplyTo("850722725@qq.com","傲史之龙"); // 回复地址

	$mail->From       = "850722725@qq.com"; //邮箱用户名
	$mail->FromName   = "傲史之龙"; //邮箱别名

	$to = "125580748@qq.com";   //收件人邮箱

	$mail->AddAddress($to);  //收件人地址 

	$mail->Subject  = $name; //标题

	$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
	$mail->WordWrap   = 20000; // set word wrap

	$mail->Body      =$body;

	$mail->IsHTML(true);   // send as HTML
	$mail->Send();
	echo "<script>alert('Message has been sent!');history.back();</script>";
} catch (phpmailerException $e) {
	echo "<script>alert('$e->errorMessage()');</script>";
} 
?>